package collection_homework;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

public class CollectionToArray2 {
    public static void main(String[] args) {
        Collection<String> c2 = new ArrayList<>();
        c2.add("one");
        c2.add("two");
        c2.add("three");
        c2.add("four");
        c2.add("fvie");
        System.out.println(c2);

        String[]array = c2.toArray(new String[4]);
        System.out.println(Arrays.toString(array));

        String[]array1 = c2.toArray(new String[9]);
        System.out.println(Arrays.toString(array1));

        String[]array2 = c2.toArray(new String[c2.size()]);
        System.out.println(Arrays.toString(array2));

    }
}
